package com.chj233.greenView.green;

import android.os.Bundle;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.chj233.libapp.Constance;
import com.chj233.greenView.R;

@Route(path = Constance.GREEN_VIEW)
public class GreenActivity extends AppCompatActivity implements View.OnClickListener {

    /**
     * 接收页面传递参数注意事项
     * 这里的变量名称要和上一个页面传递过来的key一样
     * 且结果类型也要一样
     */
    @Autowired()//自动接收上一个页面传递过来的值
    int user;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_view1);
        ARouter.getInstance().inject(this);
        findViewById(R.id.mains).setOnClickListener(this);
        findViewById(R.id.view2).setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == R.id.mains) {
            ARouter.getInstance().build(Constance.MAIN_VIEW).navigation();
        } else if (id == R.id.view2) {
            ARouter.getInstance().build(Constance.BLUE_VIEW).navigation();
        }
    }
}